//@ sourceURL=HiddenDangerView.js
Ext.ns("HiddenDangerView");

HiddenDangerView = Ext.extend(Ext.Panel,{
    constructor : function(a) {
        Ext.applyIf(this, a);
        var all=this.initUIComponents();
        HiddenDangerView.superclass.constructor.call(this, {
            id : "HiddenDangerView",
            region : "center",
            layout : "border",
            border : false,
            iconCls : "menu-position",
            items : [all.yearGridPanel,all.yearGridSearchPanel]
        });
    },
    initUIComponents : function() {
    var yearGridComponents=new creategridview({
        topbar : {
            inputFormName : 'HiddenDangerForm',
            topbarAdd:{
                hidden:false
            },
            topbarDel:{
                hidden:false
            }
        },
       search : {
            items : [ {
                style : "margin:5px 5px 5px 5px;",
                text : "隐患名称"
            }, {
                columnWidth : 0.2,
                xtype : "textfield",
                name : "Q_hiddenDangerName_S_LK",
                maxLength : 256
            } ]
        },
        grid : {
            title : "隐患记录列表",
            rowActions:true,
            listUrl : __ctxPath + "/safecheckplan/listHiddenDanger.do?Q_hiddenDangerId_L_EQ="+this.hiddenDangerId,
            removeUrl : __ctxPath + "/safecheckplan/deleteHiddenDanger.do",
            fields : [ "id","hiddenDangerName","dangerLevel", "dangerCategory","dangerRank","leader"],
            columns : [ {
                header : "id",
                dataIndex : "id",
                hidden : true
            },{
                header : "隐患名称",
                dataIndex : "hiddenDangerName",
                width:80
            },{
                header : "危险程度",
                dataIndex : "dangerLevel",
                width:70
            },{
                header : "隐患类别",
                dataIndex : "dangerCategory",
                width:80
            },{
                header : "隐患等级",
                dataIndex : "dangerRank",
                width:80
            },{
                header : "负责人",
                dataIndex : "leader",
                width:80
            }, new Ext.grid.Column({
                header : "问题明细",
                dataIndex : "scIdps",
                sortable : false,
                scope:this,
                width :70,
                renderer : function(value, metadata, record, rowIndex, colIndex) {//metadata jss : String attr : String 
                	   
                	   var k = "";
                       k += '<button title="问题明细" value="" class="btn-showDetail" onclick=\'HiddenDangerView.detail('
                           + record.data.id + ')\'></button>';
               return k;
                
                }
            })]
        },
        formCfg : {
        	hiddenDangerId : this.hiddenDangerId
        }
        
    });
    return yearGridComponents;
}
});

HiddenDangerView.detail= function detail(id){
	console.log(id);
	  new ProblemDetailWindow({
		  problemDetailId : id,
		  operation : Constant.Operation.EDIT
	    }).show();
	 
};
HiddenDangerView.LookOver=function LookOver(id){
	  new ProblemDetailForm({
		  id :id,
          operation : Constant.Operation.EDIT
	    }).show();
};

HiddenDangerView.edit = function(id) {
    new HiddenDangerForm({
        id : id,
        operation: Constant.Operation.EDIT
    }).show();
};